<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>component组件拆分</title>
    <script src="./vue.js"></script>
</head>
<body>
    <div id="app">
            <input v-model="inputValue"/>
            <button @click="handleSubmit">提交</button>
            <ul>
                <my-list v-for="aa in values"
                v-bind:value="aa"></my-list>
            </ul>
        </div>
        <script>
            Vue.component('my-list',{
                props:['value'],
                template:'<li>{{value}}</li>'
            })
            new Vue({
                el:"#app",
                data:{
                    inputValue:"hello",
                    values:[]
                },
                methods:{
                    handleSubmit: function() {
                        this.values.push(this.inputValue);
                        this.inputValue = "";
                    }
                }
    
            })
        </script>
</body>
</html>